<section class="header clearfix">
  <div class="right-buttons">
    {{#link-to-external
       "global-admin.security.cloud-credentials"
       classNames="btn btn-sm bg-primary"
    }}
      <i class="icon icon-gear"></i>
      {{t "nodeTemplatesPage.rightButtons.cloudCredentials"}}
    {{/link-to-external}}
    <button
      class="btn btn-sm bg-primary" type="button" {{action "newTemplate"}}
    >
      {{t "nodeTemplatesPage.rightButtons.actionButton"}}
    </button>
  </div>

  <h1>{{t "nodeTemplatesPage.header"}}</h1>
</section>

<section>
  {{#sortable-table
     tableClassNames="bordered"
     bulkActions=true
     paging=false
     search=false
     sortBy=sortBy
     headers=headers
     descending=descending
     extraSearchFields=extraSearchFields
     groupByKey="creatorId"
     groupByRef="nodetemplate"
     body=filteredNodeTemplates
     as |sortable kind row dt|
  }}
    {{#if (eq kind "row")}}
      {{node-template-row model=row dt=dt}}
      {{#if (or row.displayUserLabelStrings.length row.displayTaintsStrings.length)}}
        <tr class="sub-row">
          <td colspan="2"></td>
          <td colspan="5">
            {{#each row.displayTaintsStrings as |taint|}}
              <span class="tag-xs bg-warning">{{taint}}</span>
            {{/each}}
            {{#each row.displayUserLabelStrings as |label|}}
              <span class="tag-xs bg-info">{{label}}</span>
            {{/each}}
          </td>
        </tr>
      {{/if}}
    {{else if (eq kind "group")}}
      <tr class="group-row">
        <td colspan="8" class="pl-20">{{t "nodeTemplatesPage.table.owner"}}: {{row.items.firstObject.creator.displayName}}</td>
      </tr>
    {{else if (eq kind "norows")}}
      <tr>
        <td colspan="{{sortable.fullColspan}}" class="text-center text-muted pt-20 pb-20">
          {{t "nodeTemplatesPage.table.noData"}}
        </td>
      </tr>
    {{/if}}
  {{/sortable-table}}
</section>
